package com.videoaggre.zcl.ui.viewmodel

import androidx.lifecycle.lifecycleScope
import com.videoaggre.zcl.db.QimanComicBrowse
import com.videoaggre.zcl.db.mQimanDao
import com.videoaggre.zcl.parse.BaseParse
import com.videoaggre.zcl.parse.impl.QimanParse
import com.videoaggre.zcl.ui.fragment.parseHtml
import kotlinx.android.synthetic.main.qiman_activity_browse.*
import kotlinx.coroutines.launch
import kotlinx.coroutines.suspendCancellableCoroutine

class QimanBrowseViewModel : BaseViewModel() {
//    fun queryQimanComicBrowseById(mSerieId: String) {
//        launchUI({
//            var mQimanComicBrowse = mQimanDao.queryQimanComicBrowseById(mSerieId)
//            if (mQimanComicBrowse == null)
//                suspendCancellableCoroutine<QimanComicBrowse> {
//                    parseHtml(BaseParse(this@QimanBrowseActivity, this@QimanBrowseActivity, QimanParse.getQimanBrowse(worksId, mSerieId), loadService = mLoadService, refreshLayout = refreshLayout) {
//                        lifecycleScope.launch {
//                            mQimanComicBrowse = QimanParse.parseComicBrowse(mSerieId, it).also { mQimanDao.addQimanComicBrowse(it) }
//                            handQimanComicBrowse()
//                        }
//                    })
//                }
//        })
//    }

}